package com.hzxy.yiyid.web.module.repository.entity;

import com.hzxy.yiyid.web.common.constants.YiyidConstants;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @ClassName MedicareDrugDo
 * @Description TOOD
 * @Author RAICOM2023
 * @Date 2023/3/6 18:45
 * @Version 1.0
 **/
@Data
@Entity
@Table(name = "medicare_drug")
public class MedicareDrugDo implements Serializable {
    private static final long serialVersionUID = 5058469763069555196L;

    @Id
    @Column(name = "id")
    @GenericGenerator(
            name = "generator_medicare_drug",
            strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
            parameters = {
                    @Parameter(name = "sequence_name", value = "s_medicare_drug"),
                    @Parameter(name = "initial_value", value = "1"),
                    @Parameter(name = "increment_size", value = "1")
            }
    )
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "generator_medicare_drug")
    private Long id;

    /**
     * 规格
     */
    @Column(name = "gg")
    private String gg;

    /**
     * 商品名
     */
    @Column(name = "spm")
    private String spm;

    /**
     * 包装材质
     */
    @Column(name = "bzcz")
    private String bzcz;

    /**
     * 单位
     */
    @Column(name = "dw")
    private String dw;

    /**
     * 主键
     */
    @Column(name = "zj")
    private String zj;

    /**
     * 转换比
     */
    @Column(name = "zhb")
    private String zhb;

    /**
     * 备注
     */
    @Column(name = "bz",columnDefinition="TEXT")
    private String bz;

    /**
     * 招标药品通用名
     */
    @Column(name = "tym")
    private String tym;

    /**
     * 生产企业
     */
    @Column(name = "scqy")
    private String scqy;

    /**
     * 剂型
     */
    @Column(name = "jx")
    private String jx;

    /**
     * 保存时间
     */
    @Column(name = "save_time")
    @DateTimeFormat(pattern = YiyidConstants.DATE_FORMAT_DEFAULT_VIEW)
    private Date saveTime = new Date();

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    @DateTimeFormat(pattern = YiyidConstants.DATE_FORMAT_DEFAULT_VIEW)
    private Date updateTime;

    public MedicareDrugDo(){

    }

    public MedicareDrugDo(String gg, String spm, String bzcz, String dw, String zj, String zhb, String bz, String tym
            , String scqy, String jx) {
        this.gg = gg;
        this.spm = spm;
        this.bzcz = bzcz;
        this.dw = dw;
        this.zj = zj;
        this.zhb = zhb;
        this.bz = bz;
        this.tym = tym;
        this.scqy = scqy;
        this.jx = jx;
        this.saveTime = new Date();
    }
}
